<template>
  <div class="search_card">
    <el-input
        placeholder="开始搜索"
        prefix-icon="el-icon-search"
        v-model="search" clearable
        style="margin-bottom: 10px" v-on:input="findBlogs()">
    </el-input>
    <div class="hint mini">
      分类、标签、文章名都可以搜索哦，试一下吧 ~~~
    </div>
  </div>
</template>

<script>
export default {
  name: "SideBarSearch",
  data() {
    return {
      search: ''
    }
  },
  watch:{
    search(n){
      this.$emit('searchWords', n)
    }
  },
  methods:{
    findBlogs(){
      //todo
      this.sendToParent();
    },
    sendToParent(){
      this.$emit('findFromAllBlogs',{title:this.search})
    }
  }
}
</script>

<style scoped>
.search_card {
  text-align: left;
}
.hint{
  color: rgba(0,0,0,0.5);
  line-height: 20px;
  padding: 5px;
}
</style>